Skip to content

Conversation

@dermitzos
Copy link
Collaborator

This pull request adds support for the modulo (%) and modulo assignment (%=) operators in the Arcscript language implementation. It updates the grammar, interpreter logic, and test coverage to handle these operators, including correct runtime error handling for invalid operations like division by zero.

Grammar and Parser Enhancements:

  • Added MOD (%) and ASSIGNMOD (%=) tokens to ArcscriptLexer.g4 and updated ArcscriptParser.g4 to support modulo and modulo assignment in expressions and assignments. [1] [2] [3]

Interpreter Logic Updates:

  • Updated ArcscriptVisitor.js to evaluate modulo and modulo assignment operations, including error checking for division by zero. [1] [2] [3] [4]

Test Coverage Improvements:

  • Added new valid and runtime error test cases for % and %= operators to valid.json and runtimeErrors.json. [1] [2]

@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@arcweave/arcscript@8

commit: df88b85

@dermitzos dermitzos force-pushed the feat/add-modulo-operator branch from c7a4c41 to a15f659 Compare January 24, 2026 13:28
@dermitzos dermitzos force-pushed the feat/add-modulo-operator branch from 72e0613 to df88b85 Compare January 26, 2026 17:25
@dermitzos dermitzos merged commit 29afa5a into main Jan 27, 2026
5 checks passed
@dermitzos dermitzos deleted the feat/add-modulo-operator branch January 27, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants